Gets the status of the specified service.
obj.GetServiceStatus(ServiceName String, ServiceStatus String, [ServiceStatusNumber Variant] [ComputerName String]) Where obj is an OpScrUtil.SCManager object.
ServiceName
|
Specifies the name of the service to retrieve status. |
ServiceStatus
|
Returns the status of the specified service as a string. Possible values are: Stopped; Running; Start Pending; Stop Pending; Continue Pending; Pause Pending; Paused. |
ServiceStatusNumber
|
Returns the status of the specified service as a number. This parameter is optional. Possible values are: 1 - Stopped; 2 - Start Pending; 3 - Stop Pending; 4 - Running; 5 - Continue Pending; 6 - Pause Pending; 7 - Paused. |
ComputerName
|
Specifies target computer. This parameter is optional. If not specified or an empty string, the local computer is the target. |
Boolean.
To get status of the messenger
service on the local computer:
Set obj = CreateObject("OpScrUtil.SCManager") bOK = obj.GetServiceStatus("messenger", vServiceStatusString, vServiceStatusNumber) strMsg = "Service status is " & vServiceStatusString & ". Status number is " & vServiceStatusNumber